package net.jalbum.filters.arty;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import net.jalbum.filterManager.FilterProperties.FilterCategory;
import se.datadosen.jalbum.JAFilter;
import se.datadosen.jalbum.Msg;

/**
 *
 * @author Sarah Schölzel
 */
public class ArtyPlugin extends MyBasicFilter {

    private ArtyControl control;
    private Effect effect = Effect.none;

    /**
     * Constructor
     */
    public ArtyPlugin() {
        this.name = Msg.getString(this, "filters.arty.name");
        this.shortName = Msg.getString(this, "filters.arty.shortName");
        this.icon = new ImageIcon(this.getClass().getResource("arty.png"));
        this.author = "Sarah Schölzel";
        this.version = "1.0";
        this.description = Msg.getString(this, "filters.arty.description");
        this.category = FilterCategory.FUN;
        this.prescale = false;
        this.postscale = true;
        this.control = new ArtyControl(this);
    }

    @Override
    public BufferedImage renderImage(BufferedImage bi) {
        JAFilter effectClass = effect.getFilter();
        return effectClass.filter(bi, null);
    }

    @Override
    public JPanel getControls() {
        return this.control;
    }

    public Effect getEffect() {
        return effect;
    }

    public void setEffect(Effect effect) {     
        this.effect = effect;
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                renderImage();
            }
        });
    }
}